﻿using Castle.Facilities.Logging;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Services.Logging.Log4netIntegration;
using Castle.Windsor;
using log4net.Config;

[assembly: XmlConfigurator(Watch = true)]

namespace Hiver.WebApi.Installers
{
    /// <summary>
    /// 日志注册
    /// </summary>
    public class LoggerInstaller : IWindsorInstaller
    {
        /// <summary>
        /// 注册日志
        /// </summary>
        /// <param name="container"></param>
        /// <param name="store"></param>
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            XmlConfigurator.Configure();
            container.AddFacility<LoggingFacility>(f => f.LogUsing<Log4netFactory>().WithConfig("log4net.config"));
        }
    }
}